/*
 * @Author: yxw
 * @Date: 2019-02-25 14:24:17
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2019-02-25 15:50:39
 * @Description: 规划立项相关api
 */

import request from '@/router/axios'
import {projectUrls} from '@/const/apiUrl'

/**
 * 立项列表查询
 * @param {*} query
 */
export function projectRegister (query) {
  return request({
    url: projectUrls.projectRegister,
    method: 'get',
    params: query
  })
}

export function projectRegisterTrack (query) {
  return request({
    url: projectUrls.projectRegisterTrack,
    method: 'get',
    params: query
  })
}


export function projectList (query) {
  return request({
    url: projectUrls.projectList,
    method: 'get',
    params: query
  })
}

export function projectListAll (query) {
  return request({
    url: projectUrls.projectListAll,
    method: 'get',
    params: query
  })
}

export function projectListDept (query) {
  return request({
    url: projectUrls.projectListDept,
    method: 'get',
    params: query
  })
}

export function projectListDeptForList (query) {
  return request({
    url: projectUrls.projectListDeptForList,
    method: 'get',
    params: query
  })
}


/**
 * 立项申请(暂存)
 */
export function registerInfo (obj) {
  return request({
    url: projectUrls.registerinfo,
    method: 'post',
    data: obj
  })
}

/**
 * 立项申请（保存并提交）
 */
export function projectSaveAndSubmit (obj) {
  return request({
    url: projectUrls.projectSaveAndSubmit,
    method: 'post',
    data: obj
  })
}

/**
 * 立项修改
 */
export function projectUpdate (obj) {
  return request({
    url: projectUrls.projectUpdate + obj.registerinfoId,
    method: 'put',
    data: obj
  })
}

/**
 * 判断是否为发改角色
 */
export function fgwJudge () {
  return request({
    url: projectUrls.fgwJudge,
    method: 'put',
  })
}

/**
 * 立项修改并提交
 */
export function projectUpdateAndSubmit (obj) {
  return request({
    url: projectUrls.projectUpdateAndSubmit + obj.registerinfoId,
    method: 'put',
    data: obj
  })
}

/**
 * 立项提交
 */
export function projectCommit (id) {
  return request({
    url: projectUrls.projectCommit + id,
    method: 'put'
  })
}

/**
 * 立项删除
 */
export function projectDelete (id) {
  return request({
    url: projectUrls.projectDelete + id,
    method: 'delete'
  })
}

/**
 * 立项详情
 */
export function projectDetail (id) {
  return request({
    url: projectUrls.projectDetail + id,
    method: 'get'
  })
}

/**
 * 立项初审
 */
export function firstTrialFor (taskId,obj) {
  return request({
    url: projectUrls.firstTrialFor + taskId,
    method: 'put',
    data:obj
  })
}

/**
 * 立项审核
 */
export function projectCheckFor (taskId,obj) {
  return request({
    url: projectUrls.projectCheckFor + taskId,
    method: 'put',
    data:obj
  })
}

/**
 * 获取参与的规划申请
 */
export function myProject (query) {
  return request({
    url: projectUrls.myProject,
    method: 'get',
    params: query
  })
}

/**
 * 发起会商
 */
export function projectStartDiscussion (taskId,obj) {
  return request({
    url: projectUrls.projectStartDiscussion + taskId,
    method: 'put',
    data:obj
  })
}

/**
 *  获取会商列表
 */
export function getConsultList (obj) {
  return request({
    url: projectUrls.getConsultList,
    method: 'get',
    params:obj
  })
}

/**
 *  分页获取会商列表
 */
export function pageTopicRelate (params) {
  return request({
    url: projectUrls.pageTopicRelate,
    method: 'get',
    params: params
  })
}

/**
 * 跳过会商
 */
export function projectNoDiscussion (query) {
  return request({
    url: projectUrls.projectNoDiscussion + query.taskId,
    method: 'put'
  })
}
/**
 * 结束会商
 */
export function projectEndDiscussion (obj) {
  return request({
    url: projectUrls.projectEndDiscussion+obj.taskId,
    method: 'put'
  })
}

/**
 * 上报审核
 */
export function reportAudit (obj) {
  return request({
    url: projectUrls.reportAudit+"?taskId="+obj.taskId,
    method: 'post'
  })
}

/**
 * 获取历史办理情况
 * @param obj
 */
export function historyTask (infoId,obj) {
  return request({
    url: projectUrls.historyTask+infoId,
    method: 'get',
    params:obj
  })
}


/**
 * 获取立项统计
 * @param obj
 */
export function projectStatistics (query) {
  return request({
    url: projectUrls.projectStatistics,
    method: 'get',
    params:query
  })
}

/**
 * 导出待办规划信息
 * @param {*}
 * @param {*}
 */
export function exportScheduleData (query) {
  return request({
    url: projectUrls.exportScheduleData,
    method: 'get',
    responseType: 'blob',
    params: query
  })
}


/**
 * 导出待办规划信息excel
 * @param {*}
 * @param {*}
 */
export function exportScheduleDataExcel (query) {
  return request({
    url: projectUrls.exportScheduleDataExcel,
    method: 'get',
    responseType: 'blob',
    params: query
  })
}
